import java.util.*;

/**
 * Created With IntelliJ IDEA
 * Description:牛客网：点击消除
 * <a href="https://www.nowcoder.com/practice/8d3643ec29654cf8908b5cf3a0479fd5">...</a>
 * User: DELL
 * Data: 2023-02-13
 * Time: 23:21
 */
public class Main {
    /**
     * 方法一：使用StringBuffer或者StringBuilder来实现
     * @param args
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        StringBuffer str2 = new StringBuffer();
        int size = 0; //记录str2中已有的字符个数
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (size == 0 || ch != str2.charAt(size-1)) {
                str2.append(ch);
                size++;
            } else {
                str2.deleteCharAt(size-1);
                size--;
            }
        }
        if (size == 0) {
            System.out.println("0");
        } else {
            System.out.println(str2.toString());
        }
    }
    /**
     * 方法二：利用辅助栈来实现
     * @param args
     */
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        //建立辅助栈
        Deque<Character> stack = new LinkedList<>();
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (stack.isEmpty() || ch != stack.peek()) {
                stack.push(ch);
            } else {
                stack.pop();
            }
        }
        //空串输出'0'
        if (stack.isEmpty()) {
            System.out.println("0");
        } else {
            List<Character> list = new ArrayList<>();
            while (!stack.isEmpty()) {
                list.add(stack.pop());
            }
            Collections.reverse(list);
            for (int i = 0; i < list.size(); i++) {
                System.out.print(list.get(i));
            }
        }
    }
}
